use actix_web::{web, HttpResponse};

use crate::{services::wechat_service::WechatService, AppResult};

use super::OK_RESPONSE;
mod ctrl_struct {}

// test begin
#[allow(dead_code)]
async fn test_req(svr: web::Data<WechatService>) -> AppResult<HttpResponse> {
    let res = svr.test_req().await?;
    Ok(HttpResponse::Ok().json(res))
}
#[allow(dead_code)]
async fn init_db(svr: web::Data<WechatService>) -> AppResult<HttpResponse> {
    svr.find_or_init_global_config().await?;
    Ok(HttpResponse::Ok().json(OK_RESPONSE))
}
#[allow(dead_code)]
async fn test_access_token(svr: web::Data<WechatService>) -> AppResult<HttpResponse> {
    let res = svr.update_access_token().await?;
    Ok(HttpResponse::Ok().json(res))
}

// test end
#[allow(unused_variables)]
pub fn configure_wechat_controller(cfg: &mut web::ServiceConfig) {
    // cfg.service(
    //     web::scope("test")
    //         .route("req", web::get().to(test_req))
    //         .route("access_token", web::get().to(test_access_token))
    //         .route("init_db", web::get().to(init_db)),
    // );
}
